@file:Suppress("UNCHECKED_CAST", "USELESS_CAST", "INAPPLICABLE_JVM_NAME", "UNUSED_ANONYMOUS_PARAMETER", "NAME_SHADOWING")
package uni.UNIB71475B
import io.dcloud.uniapp.*
import io.dcloud.uniapp.extapi.*
import io.dcloud.uniapp.framework.*
import io.dcloud.uniapp.runtime.*
import io.dcloud.uniapp.vue.*
import io.dcloud.uniapp.vue.shared.*
import io.dcloud.uts.*
import io.dcloud.uts.Map
import io.dcloud.uts.Set
import io.dcloud.uts.UTSAndroid
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Deferred
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.async
import uts.sdk.modules.utsGetNativeView.canWebViewGoBack
import io.dcloud.uniapp.extapi.exit as uni_exit
import io.dcloud.uniapp.extapi.getFileSystemManager as uni_getFileSystemManager
import io.dcloud.uniapp.extapi.showToast as uni_showToast
val runBlock1 = run {
    __uniConfig.getAppStyles = fun(): Map<String, Map<String, Map<String, Any>>> {
        return GenApp.styles
    }
}
var firstBackTime: Number = 0
open class GenGlobalData {
    open var webviewContext = null as WebviewContext?
}
open class GenApp : BaseApp {
    constructor(__ins: ComponentInternalInstance) : super(__ins) {
        onLaunch(fun(_: OnLaunchOptions) {
            console.log("App Launch")
        }
        , __ins)
        onAppShow(fun(_: OnShowOptions) {
            console.log("App Show")
        }
        , __ins)
        onAppHide(fun() {
            console.log("App Hide")
        }
        , __ins)
        onLastPageBackPress(fun() {
            console.log("App LastPageBackPress", this.globalData)
            if (canWebViewGoBack("web-view")) {
                this.globalData.webviewContext?.back()
            } else {
                if (firstBackTime == 0) {
                    uni_showToast(ShowToastOptions(title = "再按一次退出应用", position = "bottom"))
                    firstBackTime = Date.now()
                    setTimeout(fun(){
                        firstBackTime = 0
                    }, 2000)
                } else if (Date.now() - firstBackTime < 2000) {
                    firstBackTime = Date.now()
                    uni_exit(null)
                }
            }
        }
        , __ins)
        onExit(fun() {
            console.log("App Exit")
        }
        , __ins)
    }
    open val globalData: GenGlobalData
        get() {
            return getApp().globalData
        }
    companion object {
        val styles: Map<String, Map<String, Map<String, Any>>> by lazy {
            normalizeCssStyles(utsArrayOf(
                styles0
            ))
        }
        val styles0: Map<String, Map<String, Map<String, Any>>>
            get() {
                return utsMapOf("uni-row" to padStyleMapOf(utsMapOf("flexDirection" to "row")), "uni-column" to padStyleMapOf(utsMapOf("flexDirection" to "column")))
            }
    }
}
val GenAppClass = CreateVueAppComponent(GenApp::class.java, fun(): VueComponentOptions {
    return VueComponentOptions(type = "app", name = "", inheritAttrs = true, inject = Map(), props = Map(), propsNeedCastKeys = utsArrayOf(), emits = Map(), components = Map(), styles = GenApp.styles)
}
, fun(instance): GenApp {
    return GenApp(instance)
}
)
val jsLongPressImg = "\n	!function(document) { \n		function clearLongPressTimer(timer) {\n			clearTimeout(timer);\n		}\n		if(window.handleListen){\n			window.removeEventListener(\"touchstart\", window.handleListen);\n		}else{\n			window.handleListen= function(e) {\n				let timer = setTimeout(() => {\n					if (e.target.tagName === \"IMG\") {\n						uni.webView.postMessage({\n							data: {  \n								type: 'JsGetString',\n								action: 'longPressImg',\n								query: {\n									src: e.target.src,\n								}\n							}  \n						}) \n					}\n				}, 500);\n				window.addEventListener(\"touchend\", function () {\n					clearLongPressTimer(timer);\n				});\n				window.addEventListener(\"touchmove\", function () {\n					clearLongPressTimer(timer);\n				});\n			};\n		}\n		window.addEventListener(\"touchstart\", window.handleListen);\n	}(document)\n	"
val jsGetTitle = "\n	!function(document) {  \n		var title = document.title;  \n		uni.webView.postMessage({\n			data: {  \n				type: 'JsGetString',\n				action: 'getPageTitle',\n				query: {\n					pageTitle: title\n				}\n			}  \n		})  \n	}(document)  \n	"
val `default` = "/assets/uniicons.ab33ac77.ttf"
val GenComponentsUniNavbarLiteUniNavbarLiteClass = CreateVueComponent(GenComponentsUniNavbarLiteUniNavbarLite::class.java, fun(): VueComponentOptions {
    return VueComponentOptions(type = "component", name = GenComponentsUniNavbarLiteUniNavbarLite.name, inheritAttrs = GenComponentsUniNavbarLiteUniNavbarLite.inheritAttrs, inject = GenComponentsUniNavbarLiteUniNavbarLite.inject, props = GenComponentsUniNavbarLiteUniNavbarLite.props, propsNeedCastKeys = GenComponentsUniNavbarLiteUniNavbarLite.propsNeedCastKeys, emits = GenComponentsUniNavbarLiteUniNavbarLite.emits, components = GenComponentsUniNavbarLiteUniNavbarLite.components, styles = GenComponentsUniNavbarLiteUniNavbarLite.styles)
}
, fun(instance): GenComponentsUniNavbarLiteUniNavbarLite {
    return GenComponentsUniNavbarLiteUniNavbarLite(instance)
}
)
val fs = uni_getFileSystemManager()
val GenPagesIndexIndexClass = CreateVueComponent(GenPagesIndexIndex::class.java, fun(): VueComponentOptions {
    return VueComponentOptions(type = "page", name = "", inheritAttrs = GenPagesIndexIndex.inheritAttrs, inject = GenPagesIndexIndex.inject, props = GenPagesIndexIndex.props, propsNeedCastKeys = GenPagesIndexIndex.propsNeedCastKeys, emits = GenPagesIndexIndex.emits, components = GenPagesIndexIndex.components, styles = GenPagesIndexIndex.styles)
}
, fun(instance): GenPagesIndexIndex {
    return GenPagesIndexIndex(instance)
}
)
fun createApp(): UTSJSONObject {
    val app = createSSRApp(GenAppClass)
    return UTSJSONObject(Map<String, Any?>(utsArrayOf(
        utsArrayOf(
            "app",
            app
        )
    )))
}
fun main(app: IApp) {
    definePageRoutes()
    defineAppConfig()
    (createApp()["app"] as VueApp).mount(app, GenUniApp())
}
open class UniAppConfig : io.dcloud.uniapp.appframe.AppConfig {
    override var name: String = "tuns-uniapp-mobile"
    override var appid: String = "__UNI__B71475B"
    override var versionName: String = "1.0.0"
    override var versionCode: String = "100"
    override var uniCompilerVersion: String = "4.56"
    constructor() : super() {}
}
fun definePageRoutes() {
    __uniRoutes.push(UniPageRoute(path = "pages/index/index", component = GenPagesIndexIndexClass, meta = UniPageMeta(isQuit = true), style = utsMapOf("navigationBarTitleText" to "腾顺")))
}
val __uniLaunchPage: Map<String, Any?> = utsMapOf("url" to "pages/index/index", "style" to utsMapOf("navigationBarTitleText" to "腾顺"))
fun defineAppConfig() {
    __uniConfig.entryPagePath = "/pages/index/index"
    __uniConfig.globalStyle = utsMapOf("navigationBarTextStyle" to "black", "navigationBarTitleText" to "腾顺", "navigationBarBackgroundColor" to "#F8F8F8", "backgroundColor" to "#F8F8F8", "navigationStyle" to "custom")
    __uniConfig.getTabBarConfig = fun(): Map<String, Any>? {
        return null
    }
    __uniConfig.tabBar = __uniConfig.getTabBarConfig()
    __uniConfig.conditionUrl = ""
    __uniConfig.uniIdRouter = utsMapOf()
    __uniConfig.ready = true
}
open class GenUniApp : UniAppImpl() {
    open val vm: GenApp?
        get() {
            return getAppVm() as GenApp?
        }
    open val `$vm`: GenApp?
        get() {
            return getAppVm() as GenApp?
        }
    open var globalData = GenGlobalData()
}
fun getApp(): GenUniApp {
    return getUniApp() as GenUniApp
}
